#ifndef __D3DXGRAPHIC_H__
#define __D3DXGRAPHIC_H__
#include <Windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <sstream>
#include <string>
#include "Global.h"
using namespace std;


class D3DXGraphic
{
private:
	static D3DXGraphic* _d3dxInstance;

	LPDIRECT3D9 pDirect3D;
public:
	static D3DXGraphic* GetInstance();

	LPDIRECT3DSURFACE9 pBackBuffer;
	LPDIRECT3DDEVICE9 pDevice;
	
	D3DXGraphic();
	~D3DXGraphic();

	bool InitWindow(HINSTANCE hInstance, HWND &hWnd);
	bool InitDirectX(HWND hWnd);
	void BeginFrame(LPDIRECT3DSURFACE9 backGround, D3DCOLOR transparent);
	void EndFrame();
	LPDIRECT3DSURFACE9 CreateSurfaceFromFile(LPSTR FilePath);
	LPDIRECT3DSURFACE9 LoadSurface(char* filePath);
	static LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

};

#endif